package com.restaurant.config;

import com.restaurant.bean.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@Slf4j
public class AppExceptionConfig {
    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public ResponseResult handle(Exception e) {
        log.error("error=====>{}", e.toString());
        return ResponseResult.error(null, "系统出错啦，请联系管理员！");
    }
}